﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace MGenScope
{
    [Serializable]
    public class EngineSettings:ICloneable,INotifyPropertyChanged
    {
        public EngineSettings()
        {
            InitTemplate = "";
            ForceTemplate = @"force$\n$";
            DivideTemplate = @"divide $depth$$\n$";
            SetFenTemplate = @"setboard $fen$$\n$";
            GetFenTemplate = @"savepos$\n$";
            DoMoveTemplate = @"$move$$\n$";
            SetInitialPositionTemplate = @"new$\n$";
            ExtractMoveRegex = @"([a-h][1-8][a-h][1-8][NRBQ]?)";
            ExtractMovesCountRegex = @"[a-h][1-8][a-h][1-8][NRBQ]? ([1-9][0-9]*)";
            EndDivideRegex = @"(Moves: [0-9]*)";
            FenRegex = "(.*)";
            FenEndRegex = "";
        }
        string workingFolder;
        public string WorkingFolder 
        {
            get
            {
                return workingFolder;
            }
            set
            {
                workingFolder = value;
                if (null != PropertyChanged)
                    PropertyChanged(this, new PropertyChangedEventArgs("WorkingFolder"));
            }
        }
        public string InitTemplate  { get; set; }
        public string ForceTemplate { get; set; }
        public string DivideTemplate { get; set; }
        public string SetFenTemplate { get; set; }
        public string GetFenTemplate { get; set; }
        public string DoMoveTemplate { get; set; }
        public string SetInitialPositionTemplate { get; set; }
        public string ExtractMovesCountRegex { get; set; }
        public string ExtractMoveRegex { get; set; }
        public string EndDivideRegex { get; set; }
        public string FenRegex { get; set; }
        public string FenEndRegex { get; set; }
        #region ICloneable Members

        public object Clone()
        {
            return MemberwiseClone();
        }

        #endregion

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
